hbridge18 2.2.1
Loading...
Searching...
No Matches
hbridge18.h File Reference

This file contains API for H-Bridge 18 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  hbridge18_t
 H-Bridge 18 Click context object. More...
struct  hbridge18_cfg_t
 H-Bridge 18 Click configuration object. More...

Macros

#define HBRIDGE18_REG_IC_STAT   0x00
 H-Bridge 18 register list.
#define HBRIDGE18_REG_OCP_STAT_1   0x01
#define HBRIDGE18_REG_OLD_STAT_1   0x04
#define HBRIDGE18_REG_CONFIG_CTRL   0x07
#define HBRIDGE18_REG_OP_CTRL_1   0x08
#define HBRIDGE18_REG_PWM_CTRL_1   0x0B
#define HBRIDGE18_REG_PWM_CTRL_2   0x0C
#define HBRIDGE18_REG_FW_CTRL_1   0x0D
#define HBRIDGE18_REG_PWM_MAP_CTRL_1   0x0F
#define HBRIDGE18_REG_PWM_MAP_CTRL_2   0x10
#define HBRIDGE18_REG_PWM_FREQ_CTRL_1   0x13
#define HBRIDGE18_REG_PWM_DUTY_CTRL_1   0x15
#define HBRIDGE18_REG_PWM_DUTY_CTRL_2   0x16
#define HBRIDGE18_REG_PWM_DUTY_CTRL_3   0x17
#define HBRIDGE18_REG_PWM_DUTY_CTRL_4   0x18
#define HBRIDGE18_REG_SR_CTRL_1   0x1D
#define HBRIDGE18_REG_OLD_CTRL_1   0x1F
#define HBRIDGE18_REG_OLD_CTRL_2   0x20
#define HBRIDGE18_REG_OLD_CTRL_3   0x21
#define HBRIDGE18_REG_OLD_CTRL_4   0x22
#define HBRIDGE18_REG_OLD_CTRL_5   0x23
#define HBRIDGE18_REG_OLD_CTRL_6   0x24
#define HBRIDGE18_IC_STAT_OTSD   0x40
 H-Bridge 18 IC_STAT register setting.
#define HBRIDGE18_IC_STAT_OTW   0x20
#define HBRIDGE18_IC_STAT_OLD   0x10
#define HBRIDGE18_IC_STAT_OCP   0x08
#define HBRIDGE18_IC_STAT_UVLO   0x04
#define HBRIDGE18_IC_STAT_OVP   0x02
#define HBRIDGE18_IC_STAT_NPOR   0x01
#define HBRIDGE18_CONFIG_CTRL_POLD_EN   0x80
 H-Bridge 18 CONFIG_CTRL register setting.
#define HBRIDGE18_CONFIG_CTRL_IC_ID_DRV8904   0x40
#define HBRIDGE18_CONFIG_CTRL_IC_ID_MASK   0x70
#define HBRIDGE18_CONFIG_CTRL_OCP_REP   0x08
#define HBRIDGE18_CONFIG_CTRL_OTW_REP   0x04
#define HBRIDGE18_CONFIG_CTRL_EXT_OVP   0x02
#define HBRIDGE18_CONFIG_CTRL_CLR_FLT   0x01
#define HBRIDGE18_OP_CTRL_1_HB4_HS_EN   0x80
 H-Bridge 18 OP_CTRL_1 register setting.
#define HBRIDGE18_OP_CTRL_1_HB4_LS_EN   0x40
#define HBRIDGE18_OP_CTRL_1_HB3_HS_EN   0x20
#define HBRIDGE18_OP_CTRL_1_HB3_LS_EN   0x10
#define HBRIDGE18_OP_CTRL_1_HB2_HS_EN   0x08
#define HBRIDGE18_OP_CTRL_1_HB2_LS_EN   0x04
#define HBRIDGE18_OP_CTRL_1_HB1_HS_EN   0x02
#define HBRIDGE18_OP_CTRL_1_HB1_LS_EN   0x01
#define HBRIDGE18_OP_CTRL_1_HB34_MASK   0xF0
#define HBRIDGE18_OP_CTRL_1_HB12_MASK   0x0F
#define HBRIDGE18_OLD_CTRL_1_HB4_OLD_DIS   0x08
 H-Bridge 18 OLD_CTRL_1 register setting.
#define HBRIDGE18_OLD_CTRL_1_HB3_OLD_DIS   0x04
#define HBRIDGE18_OLD_CTRL_1_HB2_OLD_DIS   0x02
#define HBRIDGE18_OLD_CTRL_1_HB1_OLD_DIS   0x01
#define HBRIDGE18_MOTOR_0   0
 H-Bridge 18 motor selection setting.
#define HBRIDGE18_MOTOR_1   1
#define HBRIDGE18_MOTOR_STATE_COAST   0
 H-Bridge 18 motor state setting.
#define HBRIDGE18_MOTOR_STATE_FORWARD   1
#define HBRIDGE18_MOTOR_STATE_REVERSE   2
#define HBRIDGE18_MOTOR_STATE_BRAKE_LS   3
#define HBRIDGE18_MOTOR_STATE_BRAKE_HS   4
#define HBRIDGE18_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
#define HBRIDGE18_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
#define HBRIDGE18_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  hbridge18_return_value_t { HBRIDGE18_OK = 0 , HBRIDGE18_ERROR = -1 }
 H-Bridge 18 Click return value data. More...

Functions

void hbridge18_cfg_setup (hbridge18_cfg_t *cfg)
 H-Bridge 18 configuration object setup function.
err_t hbridge18_init (hbridge18_t *ctx, hbridge18_cfg_t *cfg)
 H-Bridge 18 initialization function.
err_t hbridge18_default_cfg (hbridge18_t *ctx)
 H-Bridge 18 default configuration function.
err_t hbridge18_write_reg (hbridge18_t *ctx, uint8_t reg, uint8_t data_in)
 H-Bridge 18 write register function.
err_t hbridge18_read_reg (hbridge18_t *ctx, uint8_t reg, uint8_t *data_out)
 H-Bridge 18 read register function.
void hbridge18_enable_device (hbridge18_t *ctx)
 H-Bridge 18 enable device function.
void hbridge18_disable_device (hbridge18_t *ctx)
 H-Bridge 18 disable device function.
uint8_t hbridge18_get_fault_pin (hbridge18_t *ctx)
 H-Bridge 18 get fault pin function.
err_t hbridge18_check_communication (hbridge18_t *ctx)
 H-Bridge 18 check communication function.
err_t hbridge18_set_motor_state (hbridge18_t *ctx, uint8_t motor, uint8_t state)
 H-Bridge 18 set motor state function.

Detailed Description

This file contains API for H-Bridge 18 Click Driver.

Enumeration Type Documentation

◆ hbridge18_return_value_t

H-Bridge 18 Click return value data.

Predefined enum values for driver return values.

Enumerator
HBRIDGE18_OK 
HBRIDGE18_ERROR